package com.dfrz.household.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dfrz.household.bean.City;
import com.dfrz.household.bean.Province;
import com.dfrz.household.mapper.CityMapper;
import com.dfrz.household.mapper.ProvinceMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 作者:maweifeng
 * 日期 2021/8/13 15:19
 * 描述:
 */
@Service
public class ProvinceServiceImpl implements IProvinceService {
    @Autowired
    ProvinceMapper provinceMapper;
    @Autowired
    CityMapper cityMapper;

    @Override
    public List<Province> getAllProvince() {
        return provinceMapper.getAllProvince();
    }

    @Override
    public List<City> getAllCityById(Integer id) {
        QueryWrapper queryWrapper=new QueryWrapper();
        queryWrapper.eq("prid",id);
        return cityMapper.selectList(queryWrapper);
    }

    @Override
    public City getCity(Integer id) {
        return cityMapper.selectById(id);
    }
}
